import axios from "axios";
import {message} from "antd";

const authRequest = axios.create({
    baseURL: '/acl'
});
authRequest.interceptors.request.use((config:any) => {
    config.headers.token = localStorage.getItem('token') as string;
    return config;
})
authRequest.interceptors.response.use(({data}) => {
    if (data.code === 200) {
        return data;
    }
    message.error(data.message);
    return Promise.reject(data);
})
export default  authRequest;
